<!-- Phan khai bao bien cuc bo-->
<?php
if(isset($_REQUEST['hdn_listtype_id'])){	
	$v_listtype_id = intval($_REQUEST['hdn_listtype_id']);
}
// Luu dieu kien loc hien thoi
if ($v_list_id >0) {
	$v_list_id = $arr_single_list['PK_LIST'];
	$v_listtype_id = $arr_single_list['FK_LISTTYPE'];
	$v_list_code = _replace_bad_char($arr_single_list['C_CODE']);
	$v_list_name = _replace_bad_char($arr_single_list['C_NAME']);
	$v_list_order = $arr_single_list['C_ORDER']; 
	$v_file_name =$arr_single_list['C_FILE_NAME'];
	$v_list_status =$arr_single_list['C_STATUS'];
	$v_save_and_add_new=0;
} else {
	$v_list_id = 0;
	$v_list_code = "";
	$v_list_name = "";
	$v_list_have_file = 0;
	$v_list_order = _get_next_value("T_ONEGATE_LIST","C_ORDER","FK_LISTTYPE=$v_listtype_id");
	$v_list_status =1;
	$v_save_and_add_new=1;
}
$v_enable = "";
$v_readonly = "";
$v_str_save_and_add_new_checked="";
if ($v_save_and_add_new==1){
	$v_str_save_and_add_new_checked="checked";
}
$v_filter = "";
if(isset($_REQUEST['hdn_filter'])){
	$v_filter= _replace_bad_char(trim($_REQUEST['hdn_filter']));
}	
$v_str_list_checked="";
if ($v_list_status==1){
	$v_str_list_checked="checked";
}
$v_listtype_name = $arr_single_listtype['0']['2'];
$v_display = "none";
if ($arr_single_listtype['0']['4'] == 1){
	$v_display = "block";
}
$v_file_url = trim(CONST_AF_URL_PATH_FROM_ROOT) . $v_file_name;
$v_goto_url = "javascript:filename_onclick('T_ONEGATE_LIST', 'PK_LIST', 'C_FILE_NAME', 'C_FILE_CONTENT'," . strval($v_list_id) . ",'" . $v_file_url ."');" ;
?>
<!--bang chua tieu de cua form-->
<table width="100%" cellpadding="0" cellspacing="0">
	<tr class="large_title">
		<td><?php echo CONST_LIST_UPDATE_TITLE; ?></td>
	</tr>
</table>
<form action="index.php" method="post" name="f_dsp_single_status" enctype= "multipart/form-data">
<!-- Bat cac phim: F12=true; Insert=false; Delete=false, ESC=true; Enter=true -->
<div id="hotkey" onKeyDown="javascript:process_hot_key(true,false,false,true,true);">
<!--bang chua cac text box de nhap du lieu-->
<table width="100%" class="form_table1">
	<col width="20%"><col width="60%"><col width="20%">
	<tr>
		<input type="hidden" name="fuseaction" value="UPDATE_LIST" >
		<input type="hidden" name="hdn_list_id" value="<?php echo $v_list_id ?>" >
		<input type="hidden" name="hdn_listtype_id" value="<?php echo $v_listtype_id ?>" >
		<input type="hidden" name="hdn_item_id" value="<?php echo $v_list_id ?>" >
		<input type="hidden" name="hdn_list_status" value="<?php echo $v_list_status ?>" >
		<input name="hdn_filter" type="hidden" value="<?php echo $v_filter; ?>">
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_LISTTYPE_LABEL; ?></td>
		<td class="normal_label"><?php echo $v_listtype_name; ?></td>
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_LIST_CODE_LABEL; ?><small class="normal_starmark">*</small></td>
		<td><input  name="txt_code" type="text"  class="normal_textbox" style="width:100%" value="<?php echo $v_list_code; ?>" maxlength="<?php echo CONST_LIST_CODE_MAXLENGTH; ?>" message="<?php echo CONST_LIST_CODE_MESSAGE;?>" optional="<?php echo CONST_LIST_CODE_OPTIONAL;?>" onKeyDown="change_focus(document.forms(0),this)"></td>
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_LIST_NAME_LABEL; ?> <small class="normal_starmark">*</small></td>
		<td><textarea name="txt_name" type="text" class="normal_textarea" rows="5" style="width:100%" message="<?php echo CONST_LIST_NAME_MESSAGE;?>" optional="<?php echo CONST_LIST_NAME_OPTIONAL;?>"><?php echo $v_list_name; ?></textarea></td>
	</tr>
	<tr>
		<td class="normal_label"><?php echo CONST_ORDER_LABEL; ?></td>
		<td><input name="txt_order" type="text" class="short_number_textbox" value="<?php echo $v_list_order; ?>" maxlength="<?php echo CONST_LIST_ORDER_MAXLENGTH;?>" message="<?php echo CONST_LIST_ORDER_MESSAGE;?>" optional="<?php echo CONST_LIST_ORDER_OPTIONAL;?>" isnumeric min="<?php echo CONST_LIST_ORDER_MIN; ?>" max="<?php echo CONST_LIST_ORDER_MAX; ?>" onKeyDown="change_focus(document.forms(0),this)"></td>
	</tr>
	<tr style=" display:<?php echo $v_display;?>">
		<td class="normal_label"><?php echo CONST_ATTACH_FILE_LABEL; ?></td>
		<td>
			<input type="file" name="file_attach" style="width:98%" class="small_textbox" message="<?php echo CONST_ATTACH_FILE_MESSAGE;?>" onKeyDown="change_focus(document.forms(0),this)">
		</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td class="normal_label">
			<a href="<? echo $v_goto_url; ?>" class="normal_link"><? echo $v_file_name;?></a>
		</td>
	</tr>

	<tr class="normal_label">
		<td>&nbsp;</td>
		<td><input type="checkbox" name="chk_status" <?php echo $v_enable;?> class="normal_checkbox" <?php echo $v_str_list_checked;?> onClick="btn_single_checkbox_onclick(document.forms(0).chk_status,document.forms(0).hdn_list_status)" onKeyDown="change_focus(document.forms(0),this)"> <?php echo _CONST_STATUS_COLUMN_ACTIVE_VALUE;?></td>
	</tr>
</table>
<!--bang chua cac button-->
<table width="100%" >
	<tr>
		<td align="center" width="100%" height="40" valign="bottom"><?php
			if ($v_is_granted_update){?>
				<input type="button" name="btn_save"  class="normal_button" value="<?php echo _CONST_SAVE_BUTTON;?>" onClick="btn_save_onclick('UPDATE_LIST');" onKeyDown="change_focus(document.forms(0),this)"><?php
			}?>
				<input type="button" name="btn_back" class="normal_button" value="<?php echo _CONST_BACK_BUTTON;?>" onClick="goback();" onKeyDown="change_focus(document.forms(0),this)">	
		</td>
	</tr>
</table>					
</div>
</form>
<script language="JavaScript">
	set_focus(document.forms(0));
	window.dialogHeight = "340pt";
	window.dialogWidth = "420pt";
	window.dialogTop = "80pt";
</script>
